package cn.wbnyua.msm.web.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

/**
 * 作者：wbnyua.
 * 创建时间: 2023/2/10 21:00.
 */

@Service
public class RedisService {

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    public void sendToRedis(Long oid,Long uid,Long couponId){
        String key = uid.toString() + "," + oid.toString() + "," + couponId.toString();
        try{
            stringRedisTemplate.opsForValue().set(key, "1", 10, TimeUnit.SECONDS);
        }catch (Exception e){
            e.printStackTrace();
        }
    }


}
